<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script type="text/javascript">
	window.onload = function  () {
		var oDiv = document.getElementById('div1');
		removeClassName( oDiv, 'box' )
	}

	function removeClassName( obj, _className ) {
		if ( obj.className != '' ) {
			var arrClassName = obj.className.split(' ');
			var _index = arrIndexOf( arrClassName, _className );

			if ( _index != -1 ) {
				arrClassName.splice( _index, 1 );
				obj.className = arrClassName.join(' ');
			};
		};
		
	}

	//这个并不适合“box box1 box box”这种情况
	function arrIndexOf( arr, v ){
		for (var i = 0; i < arr.length; i++) {
			if ( arr[i] == v ) {
				return i;
			};
		};
		return -1;
	}
	</script>
</head>
<body>
	<div id="div1" class="box box1 box2 box box">111111</div>
</body>
</html>